<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta content="user-scalable=no,width=device-width, initial-scale=1" id="viewport" name="viewport" initial-scale="1">

		<script language="javascript" type="text/javascript" src="../js/js/baseJs.js"></script>

	</head>
	<body style="background:#eff6ff">

		<div class="wap-my-requirements" id="myRequirements" style="display: none;">
			<div class="wap-header">分红列表
				<a class="back" onClick="javascript:window.history.back();return false;"></a>
			</div>
			<div class="my-content-bd" style="position:static;margin-top:1rem" id="requireContent">
				<div>
					<div class="l-content" v-for="item  in listData">
						<div class="title">
							<div>时间：{{item.createTime|formatData}}</div>
							<div style="color:#3580e5;min-width: 1.8rem;text-align: right;">分红：{{item.money}}</div>
						</div>
						<div class="content">名称：{{item.stockPeriodTitle}}</div>
						<div style="padding: .1rem .4rem;">股份：{{item.stockNumber}}份</div>
					</div>
				</div>
				<div v-if="listData.length==0" style="font-size:.28rem;color:#666;margin-top:3rem;text-align:center">暂无分红</div>
			</div>
			<div class="wap-warning-message" v-if="messageContent">{{messageContent}}</div>
		</div>
		<script src="../js/js/rem_fix.js"></script>
		<script src="../js/js/common.js"></script>
		<script type="text/javascript">
			var token = getCookie("userToken");
			var userId = getCookie("userId");
			console.log(token)
			console.log(userId)
			var loginUrl = "../userBundle/login.mobile.html" + "?" + "../userBundle/myRequirements.mobile.html";
			console.log(loginUrl)
			if (!token || !userId) {
				window.location.href = loginUrl;
			}

			var uploadPayInfoApp = new Vue({
				el: '#myRequirements',
				data: {
					listData: [],
					page: 1,
					isDoingRefresh: false,
					isDoingloding: false,
					messageContent: ''
				},
				ready: function() {
					$("#myRequirements").show();
                    this.fetchList()
				},
				filters: {
					status: function(key) {
						key = parseInt(key);
						var map = {
							0: "删除",
							1: "申请中",
							2: "处理中",
							3: "成功",
							9: "获取积分",
						};
						return map[key];
					},
					formatData: function(key) {
						return formatDate(key)
					}
				},
				methods: {
                    fetchList:function(){
						if(this.isDoingFetch){
							return
						}
						this.isDoingFetch=true;
						var url="/stockDetails/getStockDetailsList";
						var data={         
						    client: 1,
						    token: token,
						    userId: userId
						  };
						  pushData(url,data,function(res){
						    console.log(res)
							this.isDoingFetch=false;
						     if(res.state){
						      this.listData=res.data.stockDetailList;
						     }else{
						      alert(res.message);
						     }
						  }.bind(this));
					},
					getTotalMoney:function(item){
						return item.stockNumber*item.moneyPerStock
					}  

				}
			});
		</script>

	</body>
</html>
